<!DOCTYPE html>
<html>
<#include "../../common/header.ftl">
<script src="${basePath}/js/goodsType/list.js?v=201711021700"></script>

<head>
<meta charset="UTF-8">
<title>商品分类管理</title>
<style>
	.left{
		float:left;
		min-width:100px;
		margin-left: 10px;
	}
	.table-margin{
		margin:5px 3%;
		width:92%;
	}
	.red-text{
		color:red;
	}
</style>

</head>
<body>
   
<div class="container" style="margin-left:5%;width:90%">
	<form class="layui-form left" action="#" >
		<div class="layui-form-item ">
		<#if permission?? && (permission.P1203??)>
		     <button type="button" class="layui-btn layui-btn-normal" id="addTopic-button">新增商品类型</button>
		</#if>
		</div>
	</form>
</div>
<table class="table table-margin">
  <thead>
      <tr>
      
         <th style="8"></th>
         <th style="width:15%">一级分类</th>
         <th style="width:15%">二级分类</th>
         <th style="width:15%">三级分类</th>
         <th style="width:15%">四级分类</th>
         <th style="width:10%">上级分类</th>
         <th style="width:8%">图标</th>
         <th style="width:8%">是否使用</th>
         <th style="width:6%">操作</th>
      </tr>
  </thead>
  <tbody>
	<#list typeList! as type>
		<tr class="grade-1 " data-id="${type.typeId}">
			<td><span class="show-span " data-type="hide"><i class="layui-icon">&#xe619;</i></span></td>
			<td>${type.name!}(${type.englishName!})</td>
			<td></td>
			<td></td>
			<td></td>
			<td></td>
			<td>
			<#if type.icon??>
				<img  src="${imgUrl+type.icon}" height="35px" width="35px" 
				 data-toggle="modal" data-target="#imgModal" onerror="this.src='${basePath}/images/default_goods.jpg'" />
			<#else>
				<img  src="${basePath}/images/default_goods.jpg" height="35px" width="35px"  data-toggle="modal" data-target="#imgModal"/> 
			</#if>
			</td>
			<td><#if type.isUsed?? &&  type.isUsed==1 >是
				<#elseif type.isUsed?? &&  type.isUsed==0 ><span class='red-text'>否</span>
				<#else>异常
				</#if>
			</td>
			<td>
				<div class="btn-group ">
				  <button type="button" class="btn btn-primary dropdown-toggle " data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
				    	操作<span class="caret"></span>
				  </button>
				  <ul class="dropdown-menu">
				  <#if permission?? && (permission.P1204??)>
				    <li><a href="#" onclick="editFun('${type.typeId}')">修改</a></li>
				  </#if>
				  <#if permission?? && (permission.P1207??)>
				    <#if type.isUsed?? &&  type.isUsed==1 >
				   		<li><a href="#" onclick="updateStatus('${type.typeId}')">禁用</a></li>
				    <#else>
				    	<li><a href="#" onclick="updateStatus('${type.typeId}')">启用</a></li>
					</#if>
				  </#if>
				  <#if permission?? && (permission.P1206??)>
				    <#if type.childrenList?? && (type.childrenList?size==0)>
				    	<li><a href="#" onclick="deleteFun('${type.typeId}')">删除</a></li>
				    </#if>
				  </#if>
				  </ul>
				</div>
			</td>
		</tr>
		<#list type.childrenList! as secondtype>
		<tr class="grade-2 type-${type.typeId}" data-id="${secondtype.typeId}">
			<td><span class="show-span" data-type="hide"><i class="layui-icon">&#xe619;</i></span></td>
			<td></td>
			<td>${secondtype.name!}(${secondtype.englishName!})</td>
			<td></td>
			<td></td>
			<td>${type.name!}</td>
			<td>
			<#if secondtype.icon??>
				<img  src="${imgUrl+secondtype.icon}" height="35px" width="35px" 
				 data-toggle="modal" data-target="#imgModal" onerror="this.src='${basePath}/images/default_goods.jpg'" />
			<#else>
				<img  src="${basePath}/images/default_goods.jpg" height="35px" width="35px"  data-toggle="modal" data-target="#imgModal"/> 
			</#if>
			</td>
			<td><#if secondtype.isUsed?? &&  secondtype.isUsed==1 >是
				<#elseif secondtype.isUsed?? &&  secondtype.isUsed==0 ><span class='red-text'>否</span>
				<#else>异常
				</#if>
			</td>
			<td>
				<div class="btn-group ">
				  <button type="button" class="btn btn-primary dropdown-toggle " data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
				    	操作<span class="caret"></span>
				  </button>
				  <ul class="dropdown-menu">
				  <#if permission?? && (permission.P1204??)>
				    <li><a href="#" onclick="editFun('${secondtype.typeId}')">修改</a></li>
				  </#if>
				  <#if permission?? && (permission.P1207??)>
				    <#if secondtype.isUsed?? &&  secondtype.isUsed==1 >
				   		<li><a href="#" onclick="updateStatus('${secondtype.typeId}')">禁用</a></li>
				    <#else>
				    	<li><a href="#" onclick="updateStatus('${secondtype.typeId}')">启用</a></li>
					</#if>
				  </#if>
				  <#if permission?? && (permission.P1206??)>
				    <#if secondtype.childrenList?? && (secondtype.childrenList?size==0)>
				    	<li><a href="#" onclick="deleteFun('${secondtype.typeId}')">删除</a></li>
				    </#if>
				  </#if>
				  </ul>
				</div>
			</td>
		</tr>
		<#list secondtype.childrenList! as thirdType>
		<tr class="grade-3 type-${type.typeId} type-${secondtype.typeId}" data-id="${thirdType.typeId}">
			<td><span class="show-span" data-type="hide"><i class="layui-icon">&#xe619;</i></span></td>
			<td></td>
			<td></td>
			<td>${thirdType.name!}(${thirdType.englishName!})</td>
			<td></td>
			<td>${secondtype.name!}</td>
			<td>
			<#if thirdType.icon??>
				<img  src="${imgUrl+thirdType.icon}" height="35px" width="35px" 
				 data-toggle="modal" data-target="#imgModal" onerror="this.src='${basePath}/images/default_goods.jpg'" />
			<#else>
				<img  src="${basePath}/images/default_goods.jpg" height="35px" width="35px"  data-toggle="modal" data-target="#imgModal"/> 
			</#if>
			</td>
			<td><#if thirdType.isUsed?? &&  thirdType.isUsed==1 >是
				<#elseif thirdType.isUsed?? &&  thirdType.isUsed==0 ><span class='red-text'>否</span>
				<#else>异常
				</#if>
			</td>
			<td>
				<div class="btn-group ">
				  <button type="button" class="btn btn-primary dropdown-toggle " data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
				    	操作<span class="caret"></span>
				  </button>
				  <ul class="dropdown-menu">
				  <#if permission?? && (permission.P1204??)>
				    <li><a href="#" onclick="editFun('${thirdType.typeId}')">修改</a></li>
				  </#if>
				  <#if permission?? && (permission.P1207??)>
				    <#if thirdType.isUsed?? &&  thirdType.isUsed==1 >
				   		<li><a href="#" onclick="updateStatus('${thirdType.typeId}')">禁用</a></li>
				    <#else>
				    	<li><a href="#" onclick="updateStatus('${thirdType.typeId}')">启用</a></li>
					</#if>
				  </#if>
				  <#if permission?? && (permission.P1206??)>
				    <#if thirdType.childrenList?? && (thirdType.childrenList?size==0)>
				    	<li><a href="#" onclick="deleteFun('${thirdType.typeId}')">删除</a></li>
				    </#if>
				  </#if>
				  </ul>
				</div>
			</td>
		</tr>
		<#list thirdType.childrenList! as finalType>
		<tr class="grade-4 type-${type.typeId} type-${secondtype.typeId} type-${thirdType.typeId}">
			<td><i class="layui-icon">&#xe623;</i></td>
			<td></td>
			<td></td>
			<td></td>
			<td>${finalType.name!}(${finalType.englishName!})</td>
			<td>${thirdType.name!}</td>
			<td>
			<#if finalType.icon??>
				<img  src="${imgUrl+finalType.icon}" height="35px" width="35px" 
				 data-toggle="modal" data-target="#imgModal" onerror="this.src='${basePath}/images/default_goods.jpg'" />
			<#else>
				<img  src="${basePath}/images/default_goods.jpg" height="35px" width="35px"  data-toggle="modal" data-target="#imgModal"/> 
			</#if>
			</td>
			<td><#if finalType.isUsed?? &&  finalType.isUsed==1 >是
				<#elseif finalType.isUsed?? &&  finalType.isUsed==0 ><span class='red-text'>否</span>
				<#else>异常
				</#if>
			</td>
			<td>
				<div class="btn-group ">
				  <button type="button" class="btn btn-primary dropdown-toggle " data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
				    	操作<span class="caret"></span>
				  </button>
				  <ul class="dropdown-menu">
				  <#if permission?? && (permission.P1204??)>
				    <li><a href="#" onclick="editFun('${finalType.typeId}')">修改</a></li>
				  </#if>
				  <#if permission?? && (permission.P1207??)>
				    <#if finalType.isUsed?? &&  finalType.isUsed==1 >
				   		<li><a href="#" onclick="updateStatus('${finalType.typeId}')">禁用</a></li>
				    <#else>
				    	<li><a href="#" onclick="updateStatus('${finalType.typeId}')">启用</a></li>
					</#if>
				  </#if>
				  <#if permission?? && (permission.P1206??)>
				    <li><a href="#" onclick="deleteFun('${finalType.typeId}')">删除</a></li>
				  </#if>
				  </ul>
				</div>
			</td>
		</tr>
		
		</#list>
		</#list>
		</#list>
	</#list>
  </tbody>
</table>
</body>
<script type="text/javascript">
	var basePath="${basePath}";
	var init={
	}
	$(function(){
		layui.use(['form', 'layer'] , function(){
		  var layer = layui.layer;
		  var form = layui.form(); 
	});
});
</script>
</html>